<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >

    <!--        <h:body>-->
    <ui:composition template="layout.xhtml">

        <ui:define name="corpo">
            <h:form id="incluir_form" acceptcharset="utf-8"> 
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}" value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('config.xhtml')}" value="Configurações" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('indexOperacao.xhtml')}" value="Operação" update="@form" immediate="true"/>>
                    <p:commandLink  value="Criar Operação" update="@form" immediate="true"/>
                </div>
                <p:panel header="Criar operacao">
                    <p:messages id="msg"/>

                    <h:panelGrid columns="2" id="panelOpe" styleClass="textAlignRight"
                                 columnClasses="textAlignRight"  >

                        <p:row>
                            <h:outputLabel value="*" style="color:red;"/>
                            <h:outputLabel value="Nome Operação:" for="tipoInput" />
                        </p:row>
                        <p:inputText id="tipoInput" value="#{managerOperacao.operacao.tipo}"
                                     required="true" requiredMessage="Campo nome deve ser preenchido." size="70"/>


                        <h:outputLabel value="Descricao:" for="descricaoInput"/>
                        <p:inputTextarea id="descricaoInput" value="#{managerOperacao.operacao.descricao}"
                                         cols="70" />


                        <h:outputLabel value=" Possui registro Anterior: " />
                        <p:row>
                            <p:selectBooleanButton value="#{managerOperacao.operacao.regAnterior}" 
                                                   onLabel="Sim" offLabel="Não" onIcon="ui-icon-check"
                                                   offIcon="ui-icon-close">  
                                <p:ajax update="columnAnt" />  
                            </p:selectBooleanButton>

                        </p:row>
                    </h:panelGrid>

                    <div class="buttonAction">
                        <h:panelGrid columns="2" id="columnAnt" styleClass="textAlignRight"
                                     columnClasses="textAlignRight" style="width: 80%; text-align: center; margin-left:17%;" >
                            <p:selectBooleanCheckbox  id="areaAnteriorButton" 
                                                      value="#{managerOperacao.operacao.areaAnterior}" 
                                                      rendered="#{managerOperacao.operacao.regAnterior}"
                                                      itemLabel="Deseja que a operação valide a Circunscrição Anterior ?"
                                                      />  
                        </h:panelGrid>
                    </div>


                    <div class="buttonAction">
                        <p:commandButton id="submit" icon="ui-icon-disk" actionListener="#{managerOperacao.criar()}"
                                         value="Salvar" update="msg, @form"/>
                        <p:commandButton id="limpar" icon="ui-icon-close" actionListener="#{managerOperacao.init()}"
                                         value="limpar" update="@form" immediate="true" />  
                    </div>                  
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
